<!DOCTYPE html>
<html>
<head>
	<title>后台管理登录 -  Powered by 后台</title>
	<meta http-equiv="Access-Control-Allow-Origin" content="*">
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="/component/layui/css/layui.css">
	<style type="text/css">
		body{background:radial-gradient(200% 100% at bottom center,#0070aa,#0b2570,#000035,#000);background:radial-gradient(220% 105% at top center,#000 10%,#000035 40%,#0b2570 65%,#0070aa);background-attachment:fixed;overflow:hidden;background-color:#0b2570;}
		@keyframes rotate{0%{transform:perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(0)}100%{transform:perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(-360deg)}}
		#particles-js {position: absolute;width: 100%;height: 100%;}
		.login-box{padding:15px 30px;border:1px solid #aaa;border-radius:5px;background-color:rgba(255,255,255, 0.2);width:260px;position:fixed;left:50%;top:50%;z-index:999;margin:-200px 0 0 -160px;}
		.layui-form-pane .layui-form-label{width:50px;background-color:rgba(255,255,255, 0.5);color:#fff;}
		.layui-form-pane .layui-input-block{margin-left:50px;}
		.login-box .layui-input{font-size:18px;font-weight:400;background-color:rgba(255,255,255, 0.5);color:#fff;display:inline-block;}
		.login-box input[name="password"]{letter-spacing:5px;font-weight:800}
		.login-box input[type="submit"]{letter-spacing:5px;}
		.login-box input[name="captcha"]{width:75px;}
		.captcha{float:right;border-radius:3px;width:120px;height:38px;overflow:hidden;}
		.login-box .layui-btn{width:100%;}
		.login-box .copyright{text-align:center;height:50px;line-height:50px;font-size:12px;color:#aaa}
		.login-box .copyright a{color:#aaa;}
		@media only screen and (min-width:750px){
			.login-box{width:350px;margin:-200px 0 0 -205px!important}
			.login-box input[name="captcha"]{width:165px;}
		}
	</style>



</head>
<body>
<div id="particles-js">
	<div class="login-box">
		<form action="{:url()}" method="post" class="layui-form layui-form-pane">
			<fieldset class="layui-elem-field layui-field-title">
				<legend style="color:#fff;">管理后台登录</legend>
			</fieldset>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="layui-icon layui-icon-username"></i></label>
				<div class="layui-input-block">
					<input type="text" name="username" class="layui-input" lay-verify="required" placeholder="登录账号" autofocus="autofocus" />
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
				<div class="layui-input-block">
					<input type="password" name="password" class="layui-input" lay-verify="required" placeholder="登录密码" />
				</div>
			</div>
			<div class="layui-form-item" {if ($loginError < 3)}style="display:none;"{/if}>
			<label class="layui-form-label"><i class="layui-icon layui-icon-vercode"></i></label>
			<div class="layui-input-block">
				<input type="text" name="captcha" class="layui-input" placeholder="验证码" /><a href="javascript:;" class="captcha"><img {if ($loginError >= 3)}src="{:captcha_src()}"{/if} height="38" width="120" id="captchaImg" alt="验证码" /></a>
			</div>
	</div>

	{:token()}
	<input type="submit" value="登录" lay-submit="formLogin" lay-filter="formLogin" class="layui-btn layui-btn-normal">
	</form>
</div>
</div>
{include file="block/layui" /}
<script src="/component/layui/layui.js"></script>
<script src="/static/common/js/particles.min.js"></script>
<script src="/static/common/js/jquery.min.js"></script>
<script type="text/javascript">
    $(function  () {
        layui.use(['form','layer'], function(){
            var form = layui.form;
            var layer = layui.layer;
            form.on("submit(formLogin)", function(data){

                $.ajax({
                    url : "{:url('userLogin')}",
                    type : "POST",
                    data : data.field,
                    dataType : "JSON",
                    success (res) {
                        if (res.code === 1) {

                            layer.open({
                                title : res.msg,
                                content : res.data,
                                btn : ['确认'],
                                yes : function () {
                                    window.location.href = "http://www.yd2021.com";
                                }
                            });

                        } else {
                            $("#__token__").val(res.token);

                            if (res.error) {
                                $("#captchaImg").attr("src","{:captcha_src()}");
                            }
                            //$("#captcha").attr("src",res.captcha);

                            layer.open({
                                title : res.msg,
                                content : res.data
                            })
                        }
                    }
                });

                return false;
            });
        });
    })
</script>
</body>
</html>